package design.createModel.factory.simpleFactory.demo1;

public class CoffeeStore {

    public Coffee orderCoffee(String name){
        //根据name的值生成不同的coffee子类
        Coffee coffee = null;
        if ("a".equals(name)){
            coffee = new AmericanCoffee();
        }else if ("l".equals(name)){
            coffee = new LatteCoffee();
        }else {
            throw new RuntimeException("sorry name is not exist");
        }
        coffee.addMilk();
        coffee.addSugar();
        return coffee;
    }

}
